<template>
  <!-- <div class='container'>添加目录对话框</div> -->
  <!-- 弹窗 -->
    <el-dialog :title="title" :visible="dialogVisible" width="30%" @close="reset">
      <el-form :model="dialogForm" :rules="rules" ref="ruleForm" label-width="100px">
        <el-form-item label="所属学科" prop="subject" >
          <el-select v-model="dialogForm.subject" placeholder="请选择" style="width:300px">
            <el-option
            v-for="(item, index) in subjectsList"
            :key="index"
            :label="item.label"
            :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="目录名称" prop="name" >
          <el-input v-model="dialogForm.name" placeholder="请输入目录名称" style="width:300px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" >
        <el-button @click="reset()">取 消</el-button>
        <el-button type="primary" @click="submit()">确 定</el-button>
      </div>
    </el-dialog>
</template>

<script>
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      // 搜索框绑定的
      form: {
        // 目录名称
        directoryName: '',
        // 状态
        state: null
      },
      // 学科简单列表的数据    这里面的value就是id
      subjectsList: '',
      // 校验
      rules: {
        subject: [
          { required: true, message: '请选择所属学科', trigger: 'change' }
        ],
        name: [
          { required: true, message: '请输入目录名称', trigger: 'blur' }
        ]
      }
    }
  }
}
</script>

<style scoped lang='less'></style>
